So far we have treated populations as either continuous or discrete, but homogeneous in their characteristics. But sometimes individual heterogeneity plays a critical role in the dynamics of the process of interest. Agent-based models (ABMs) have several important components that distinguish them from other models
Often ABMs are purely simulation models, because it can be difficulty to study their dynamics analytically or learn about them from data. Sometimes ABMs are so complex they require supercomputers to do the simulation.
All models that generate individual outcomes are agent-based models. Population-based compartmental models just assume that all the agents in the same state are homogeneous. Many statistical models qualify as agent-based models since they incorporate individualistic covariates, and may represent interactions between individuals, or exhibit complex behavior.
Researchers often hope that ABMs will exhibit emergent behavior, or complex dynamics that result from the simulation, but are not explicitly represented in the model structure. However, mostly ABMs just do exactly what researchers parameterize them to do.
Let \(T_i\) be the survival (failure) time of subject \(i\) in a trial. We can parameterize the rate, or hazard of failure as
\[ \lambda_i = \lambda(t) \exp(x_i \beta) \]
where \(\lambda(t)\) is a time-varying hazard common to all subjects, and \(\exp(x_i \beta)\) is the part that depends on subject \(i\). This is called the Cox Proporitional Hazards Model. This is an agent-based model because the outcomes are specific to each subject/agent.
Imagine we have \(N\) individuals in a closed SIR model. If \(i\) is susceptible, the rate of infeciton is
\[ \lambda_i(t) = \beta_i I(t) \]
where \(I(t)\) is the number of infectious individuals. If \(i\) is infectious, the rate of recovery is \(\gamma_i\). We could parameterize these individualistic rates as folows,
\[ \beta_i = \exp[z_i \theta] \]
\[ \gamma_i = \exp[w_i \phi] \]
where \(z_i\) and \(w_i\) are randomly drawn from a normal distribution, and \(\theta\) and \(\phi\) are fixed coefficients.
n = 10
p = 3
a = 0.2
b = c(-1,0.3,0.1)
g = c(-0.2,1,0.3)
x = matrix(rnorm(n*p,0,1), nrow=n)
tmax = 1
infectives = c()
susceptibles = 1:n
shaz = a + exp(z %*% b) # this is a vector of length n
ihaz = exp(z %*% g) # this is a vector of length n
while(t < tmax) {
haz = shaz[susceptibles] * ihaz[infectives]
w = rexp(1,sum(haz)) # next infection waiting time
if(t+w>tmax) break
i = sample(susceptibles,prob=haz) # identity of new infective
infectives = c(infectives,i)
susceptibles = susceptibles[-which(susceptibles==i)]
t = t + w
}
y = rep(0,n)
y[infectives] = 1n = 100
z = rnorm(n)
theta0 = -0.3
theta1 = -0.1
theta2 = 0.2
tmax = 10
ezt0 = exp(z * theta0)
ezt1 = exp(z * theta1)
ezt2 = exp(z * theta2)
susceptible = 2:n
infected = c(1)
recovered = c()
t = 0
while(t < tmax) {
haz_stoi = sum(ezt0[susceptible]) * sum(ezt1[infective])
w1 = rexp(1,haz_stoi)
haz_itor = 0
if(length(recovered)>0) {
haz_itor = sum(ezt2[infective])
}
w2 = rexp(1,haz_itor)
if(w1<w2) {
}
w = min(c(w1,w2))
if(t + w > tmax) break
t = t + w
}ABMs can be dangerous because they may seem complex, but are always constrained by their structure, parameterization, and calibration.
Researchers often use ABMs to predict the effect of hypothetical population-level policies before these policies are tested empirically. This can be dangerous, because assumptions about how agents behave in the absence of the intervention, and how the intervention affects their behavior, may lead researchers to draw erroneous conclusions about a situation that has never before occurred.
It is very easy to understate uncertainty in predictions/inferences from an ABM because ABMs may not capture all sources of stochasticity in the real world.
Example: What if everyone got PrEP?